'''
Created on 2012-7-22

@author: fallingboat
'''
import pymysql
from Module import JobTemplate  
def getJobList():
        conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='root', db='imonitor')
        cur = conn.cursor()
        cur.execute("SELECT * FROM job_template")
        # r = cur.fetchall()
        # print r
        # ...or...
        jobList = []
        for r in cur.fetchall():
            jt = JobTemplate()
            jt.id = r[0]
            jt.url= r[1]
            jobList.append(jt)
        
        cur.close()
        conn.close()
        return jobList
jobs = getJobList()
for t in jobs:
    print(t.id, t.url)
    


   
if __name__ == '__main__':
    pass